package net.hnjdzy.tinydict.service;


import android.util.Log;

import com.alibaba.fastjson.JSON;

import net.hnjdzy.tinydict.entity.Sentence;
import net.hnjdzy.tinydict.entity.Word;

import okhttp3.OkHttpClient;
import okhttp3.Request;
import okhttp3.Response;

public class SentenceManager {
   public  Sentence getData(String datea)throws  Exception{
     OkHttpClient  client=new OkHttpClient();
       String url="http://open.iciba.com/dsapi/?date="+datea;
       Request request=new Request.Builder().url(url).build();
       Response response=client.newCall(request).execute();
       if (response.isSuccessful()){
           String json=response.body().string();
           return JSON.parseObject(json,Sentence.class);
       }else {
           Log.d("test","网络连接错误");
           return  null;
       }
   }
}
